Skip to content

Add Si5351::reset_freq() to forget one clock output - #114

Merged
NT7S merged 2 commits into
masterfrom
cursor/reset-freq-b37e
Nov 8, 2026
Merged

NT7S merged 2 commits into
masterfrom
cursor/reset-freq-b37e

Conversation

@NT7S

@NT7S NT7S commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds public Si5351::reset_freq(enum si5351_clock clk) on current master (v2.4.1, ee6cdb0). The idea and the original patch are from @KT315AM in #104. That branch conflicts with the v2.4.x source, so this is a new implementation against master rather than a rebase of #104.

reset_freq(clk):

  • stores 0 Hz in clk_freq[clk]
  • disables that output
  • clears clk_first_set[clk] so the next set_freq() enables the output automatically, the same as the first call
  • Pass a valid si5351_clock value (SI5351_CLK0..SI5351_CLK7); out-of-range values are not supported. si5351_clock is an unfixed enum, so a value outside 0..7 is undefined behavior and rejection cannot be promised portably. The function still bounds-checks the index.

Other clocks are left unchanged: stored frequency, enable bit, first-set flag, PLL assignment, and every register except that clock's output-enable bit. reset() uses reset_freq() for its per-output initial state; the register writes match the previous loop. Version and license are unchanged.

Test plan

  • tests/regression/reset_freq/t_reset_freq.cpp (100 checks, ASan/UBSan clean): reset then set_freq re-enables CLK0, CLK3, CLK5, CLK6, and CLK7; a manual output_enable(0) does not; other clocks stay untouched
  • ./tests/regression/run_v231_checks.sh --src <tree> overall PASS: acceptance 25/25, must-not-break 776/776, t106, goldens, reset_freq 100/100
  • CI lint
  • CI compile on uno, esp32, mkrzero, and rpipico
  • CI regression workflow
Open in Web Open in Cursor 

cursoragent and others added 2 commits November 8, 2026 00:23
reset_freq() stores 0 Hz for one CLK, disables that output, and clears
its first-set flag so the next set_freq() enables it again. An invalid
clock index is ignored and other outputs are left unchanged. reset()
uses it for the per-output initial state.

Based on #104 by KT315AM.

Co-authored-by: KT315AM <kt@315.am>
Co-authored-by: Jason Milldrum <NT7S@users.noreply.github.com>
si5351_clock is an unfixed enum covering CLK0..CLK7. A value outside
that range is undefined behavior, so the README, changelog, and
function comment now say out-of-range values are not supported. The
bounds check in reset_freq() is unchanged.

Co-authored-by: Jason Milldrum <NT7S@users.noreply.github.com>
@NT7S
NT7S merged commit ffd2935 into master Nov 8, 2026
11 of 12 checks passed
This was referenced Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants